////////////////////////////////////////////////////////////////////////////////////////////////////
/// @file   CollabRCBotUnitTests\MockOperationTreeNode.h
///
/// @brief  Defines a mock implementation of a CollabRC::Bot::AI::OperationTreeNOde
////////////////////////////////////////////////////////////////////////////////////////////////////

#pragma once
#include "../CollabRCBot/OperationTreeNode.h"

/**
 * @brief Mock implementation of a CollabRC::Bot::AI::OperationTreeNode for testing.
 *
 * This mock operation simply always returns the result that was requested
 * via SetResult().
 * @version $Id$
 * @author Matthew P. Del Buono
 */
class MockOperationTreeNode :
    public CollabRC::Bot::AI::OperationTreeNode
{
private:
    float m_result;
public:
    inline MockOperationTreeNode(const ComputationalTreeNode& lhs, const ComputationalTreeNode& rhs)
        :OperationTreeNode(lhs, rhs)
    {

    }

    inline MockOperationTreeNode(const MockOperationTreeNode& copy)
        :OperationTreeNode(copy),m_result(copy.m_result)
    {
    }

    /** {@inheritDoc} */
    inline virtual float PerformOperation(float lhs, float rhs) const 
    {
        return m_result;
    }

    /**
     * @brief Sets the result of the computation of this operation
     * @param value the value to which the result should be set
     */
    inline void SetResult(float value) { m_result = value; }

    /** {@inheritDoc} */
    ComputationalTreeNode* Clone() const { return new MockOperationTreeNode(*this); };
};
